package com.design.model;

import java.awt.*;
import java.util.HashMap;
import java.util.Map;

/**
 * def
 *
 * @author lw
 * @date 2023/12/4 14:51
 **/
public class ShapeFactory {

    private static final Map<Color, Shape> circleMap = new HashMap<>();

    public static Shape getCircle(Color color) {
        Shape circle = circleMap.get(color);

        if (circle == null) {
            circle = new Circle(color);
            circleMap.put(color, circle);
        }

        return circle;
    }
}
